#pragma once

#include <QtCore/qglobal.h>
#include <tuple>
#include <qstringlist.h>


#ifndef BUILD_STATIC
# if defined(CCONFIGOPERATE_LIB)
#  define CCONFIGOPERATE_EXPORT Q_DECL_EXPORT
# else
#  define CCONFIGOPERATE_EXPORT Q_DECL_IMPORT
# endif
#else
# define CCONFIGOPERATE_EXPORT
#endif

#define CONFIG_GETINSTACE CConfigOperate::GetInstance()

#define DEBUG_SWITCH 1

class CConfigOperate
{
public:
    static CConfigOperate* GetInstance();
    [[nodiscard]] QString GetPinColor()noexcept;
    [[nodiscard]] QString GetScrewColor()noexcept;
    [[nodiscard]] QString GetThroughColor()noexcept;
    [[nodiscard]] std::tuple<QString, QString>GetNetworkCfg()noexcept;
    [[nodiscard]] QString GetCatiaR21Path()noexcept;
    [[nodiscard]] QString GetCatiaR25Path()noexcept;
    [[nodiscard]] QString GetStdPath()noexcept;
    [[nodiscard]] QString GetBinPath()noexcept;
    [[nodiscard]] QString GetSMContent()noexcept;
    [[nodiscard]] QString GetGunContent()noexcept;
    [[nodiscard]] QString GetBaseContent()noexcept;
    [[nodiscard]] QString GetUnitContent()noexcept;
    [[nodiscard]] QStringList GetToolingColorList()noexcept;
    [[nodiscard]] QString GetDefaultToolName()noexcept;
    [[nodiscard]] QString GetDefaultToolVersion()noexcept;
    [[nodiscard]] int GetStdModulLibraryVersion()noexcept;
    [[nodiscard]] int GetPlatformRelatedLibraryVersion()noexcept;
    [[nodiscard]] bool SetStdModulLibraryVersion(unsigned int version)noexcept;
    [[nodiscard]] bool SetPlatformRelatedLibraryVersion(unsigned int version)noexcept;
private:
    CConfigOperate();
    ~CConfigOperate();
    bool Vaildcfg();
    void OutputMsg(QStringView msg);
    QString GetColorImpl(const QString&key);
    QString GetPathImpl(const QString& key);
    QString GetModelImpl(const QString&key);
    QString GetData(QStringView groupname,QStringView key);
    bool SetData(QStringView groupname,QStringView key, int value);

};
